﻿@model ProductsByTagModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(string.Format(T("PageTitle.ProductsByTag").Text, Model.TagName));

    //canonical URL
    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var productsByTagUrl = Url.RouteUrl("ProductsByTag", new { productTagId = Model.Id, SeName = Model.TagSeName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(productsByTagUrl);
    }
}
@using Nop.Core.Domain.Seo
@using Nop.Core.Infrastructure
@using Nop.Web.Models.Catalog;
<div class="page product-tag-page">
    <div class="page-title">
        <h1>@String.Format(T("Products.Tags.ProductsTaggedWith").Text, Model.TagName)</h1>
    </div>
    <div class="page-body">
        @Html.Widget("productsbytag_top", Model.Id)
        @if (Model.Products.Count > 0)
        {
            @Html.Partial("_CatalogSelectors", Model.PagingFilteringContext, new ViewDataDictionary())
        }
        @Html.Widget("productsbytag_before_product_list", Model.Id)
        @if (Model.Products.Count > 0)
        {
            <div class="@(Model.PagingFilteringContext.ViewMode == "list" ? "product-list" : "product-grid")">
                <div class="item-grid">
                    @foreach (var product in Model.Products)
                    {
                        <div class="item-box">
                            @Html.Partial("_ProductBox", product)
                        </div>
                    }
                </div>
            </div>
        }
        @{
            var pager = Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber");
        }
        @if (!pager.IsEmpty())
        {
            <div class="pager">
                @pager
            </div>
        }
        @Html.Widget("productsbytag_bottom", Model.Id)
    </div>
</div>
